home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / src / fmsdisk / tag.a < prev    next >
Text File  |  1993-11-20  |  3KB  |  131 lines

  1.  
  2.         section text,CODE
  3.  
  4.         xref    _CoProc
  5.         xref    @DevInit
  6.  
  7.         xdef    _DeviceName
  8.         xdef    _IdString
  9.         xdef    _DUMmySeg
  10.  
  11.         moveq.l #0,D0        ;   word
  12.         rts            ;   word
  13.  
  14. InitDesc:
  15.         dc.w    $4AFC
  16.         dc.l    InitDesc
  17.         dc.l    EndCode
  18.         dc.b    0        ;   not auto-init
  19.         dc.b    2        ;   version
  20.         dc.b    3        ;   NT_DEVICE
  21.         dc.b    0        ;   priority
  22.         dc.l    _DeviceName
  23.         dc.l    _IdString
  24.         dc.l    _Init
  25.         dc.l    0        ;   extra ?
  26.         dc.l    0
  27.         dc.l    0
  28.  
  29.         dc.w    0        ;   word (long align)
  30.  
  31.         ds.l    0        ;   long word align
  32.  
  33.         dc.l    16        ;   dummy segment
  34. _DUMmySeg:    dc.l    0
  35.         jmp    _CoProc(pc)     ;   co-process handles IO
  36.  
  37.         section DATA,DATA
  38.  
  39. _DeviceName:    dc.b    'fmsdisk.device',0
  40. _IdString:    dc.b    'fmsdisk.device 2.2 (22 May 1991)',13,10,0
  41.  
  42. EndCode:
  43.  
  44.         ;   DICE startup and exit code attached to Init and
  45.         ;   Expunge.
  46.  
  47.         section text,code
  48.  
  49.         xref    __BSS_LEN        ; (dlink), length of BSS
  50.         xref    __DATA_BAS        ; (dlink), base of initialized data
  51.         xref    __DATA_LEN        ; (dlink), length of data
  52.  
  53.         xdef    _ADevExpunge        ; expunge called by DevExpunge()
  54.         xdef    _SysBase        ; SysBase
  55.  
  56. _Init:        move.l    A0,-(sp)            ; save segment
  57.  
  58.         movem.l D2-D7/A2-A6,-(sp)   ; blanket save
  59.         move.l    4.W,A6            ; EXEC base
  60.  
  61.         ;   Not resident, BSS space has been allocated for us
  62.         ;   beyond the specified data, just load the base ptr
  63.  
  64. snotres     lea    __DATA_BAS+32766,A4
  65.         sub.l    A3,A3
  66.  
  67. clrbss
  68.         ;   CLEAR BSS    &-32766(A4) + __DATA_LEN*4
  69.  
  70.         lea    -32766(A4),A0
  71.         move.l    #__DATA_LEN,D0
  72.         asl.l    #2,D0
  73.         add.l    D0,A0
  74.  
  75.         move.l    #__BSS_LEN,D0        ; longwords of bss
  76.         moveq.l #0,D1
  77.         bra    clrent
  78. clrlop        move.l    D1,(A0)+
  79. clrent        dbf    D0,clrlop
  80.         sub.l    #$10000,D0
  81.         bcc    clrlop
  82.  
  83.         move.l    A6,_SysBase(A4)
  84.         jsr    __AutoInit0        ; A6 has SYSBase
  85.         bne    xfail
  86.         jsr    __AutoInit1        ; A6 has SYSBase
  87.         bne    xfail
  88.  
  89.         movem.l (sp)+,D2-D7/A2-A6   ; blanket restore
  90.         move.l    (sp)+,A0            ; retrieve arg to Init to A0
  91.         jmp    @DevInit(pc)
  92.  
  93.         ;   if failure occurs (auto library open failed), return NULL
  94.  
  95. xfail        movem.l (sp)+,D2-D7/A2-A6
  96.         move.l    (sp)+,D0            ; pop/ignore arg
  97.         moveq.l #0,D0            ; return NULL
  98.         rts
  99.  
  100.         ;   Expunge, called by DevExpunge as subroutine
  101.  
  102. _ADevExpunge
  103.         movem.l A4/A6,-(sp)
  104.         move.l    4.W,A6
  105.         lea    __DATA_BAS+32766,A4
  106.         jsr    __AutoExit1
  107.         jsr    __AutoExit0
  108.         movem.l (sp)+,A4/A6
  109.         rts
  110.  
  111.         section data,data
  112.  
  113. _SysBase    dc.l    0
  114.  
  115.         ;   These are special DICE sections that merge together special
  116.         ;   code from other object modules and link libraries, the base
  117.         ;   of which is defined here.
  118.  
  119.         section autoinit0,code
  120. __AutoInit0:
  121.         section autoinit1,code
  122. __AutoInit1:
  123.         section autoexit0,code
  124. __AutoExit0:
  125.         section autoexit1,code
  126. __AutoExit1:
  127.  
  128.  
  129.         END
  130.  
  131.